﻿//======================================================
//==     (c)2008 aspxcms inc by NeTCMS v1.0              ==
//==          Forum:bbs.aspxcms.com                   ==
//==         Website:www.aspxcms.com                  ==
//======================================================
using System;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data;
using NetCMS.Content;
using NetCMS.Content.Common;
using NetCMS.Model;

public partial class manage_news_class_list : NetCMS.Web.UI.ManagePage
{
    ContentManage rd = new ContentManage();
    rootPublic pd = new rootPublic();
    public string ClassList = string.Empty;
    public string IsSuper = string.Empty;
    NetCMS.Content.UserMisc ud = new NetCMS.Content.UserMisc();
    //加载函数
    protected void Page_Load(object sender, EventArgs e)
    {
        #region 读取会员拥有权限的栏目
        NetCMS.Content.AdminGroup agc = new NetCMS.Content.AdminGroup();
        IsSuper = agc.GetAdminIsSuper(this.UserNum);

        if (IsSuper != "1")//判断是不是超级管理员
        {
            string adminGroupNumber = agc.getAdminGroup(this.UserNum);
            IDataReader rdg = agc.getAdminGroups(adminGroupNumber);
            while (rdg.Read())
            {
                if (!rdg.IsDBNull(0))
                {
                    ClassList = rdg.GetString(0);
                }
            }
            rdg.Close();
        }
        #endregion

        Response.CacheControl = "no-cache";
        string ReadType = NetCMS.Common.Public.readparamConfig("ReviewType");
        if (ReadType == "1")
        {
            makeHTML2.Enabled = false;
            makeHTML2.Text = "";
        }
        else
        {
            this.makeHTML2.Attributes.Add("onclick", "javascript:return checkTF('生成静态文件');");
        }
        this.ClassIndex.Attributes.Add("onclick", "javascript:return checkTF('生成索引页');");
        this.makeXML2.Attributes.Add("onclick", "javascript:return checkTF('生成XML');");
        this.PageNavigator1.OnPageChange += new PageChangeHandler(PageNavigator1_PageChange);
        string stat = Request.QueryString["Stat"];
        if (!IsPostBack)
        {
            if (NetCMS.Config.verConfig.PublicType != "1")
            {
                ClassIndex.Enabled = false;
            }
            if (stat != "" && stat != null)
            {
                this.Authority_Code = "C029";
                this.CheckAdminAuthority();
                string Classid =Request.QueryString["id"];
                StaticChange(Classid);
                pd.SaveUserAdminLogs(0, 1, UserNum, "锁定/解锁操作", "锁定/解锁操作栏目.ClassID:" + Request.Form["Checkbox1"] + "");
                PageRight("锁定/解锁操作栏目成功!", "class_list.aspx");
            }
            string getSiteID = Request.QueryString["SiteID"];
            if (SiteID == "0")
            {
                if (getSiteID != null && getSiteID != "")
                {
                    channelList.InnerHtml = "&nbsp;&nbsp;" + SiteList(getSiteID.ToString());
                }
                else
                {
                    channelList.InnerHtml = "&nbsp;&nbsp;" + SiteList(SiteID);
                }
            }
            //分页
            StartLoad(1);
        }
        if (Request.QueryString["Type"] == "orderAction")
        {
            string ClassId =Request.QueryString["ClassId"];
            int orderId = int.Parse(Request.QueryString["OrderId"]);
            updateOrder(ClassId, orderId);
        }

    }

    /// <summary>
    /// 得到站点列表
    /// </summary>
    /// <param name="SessionSiteID">内存总的SiteID</param>
    /// <returns>返回列表</returns>
    protected string SiteList(string SessionSiteID)
    {
        string siteStr = "<select name=\"SiteID\" id=\"SiteID\" onChange=\"getchanelInfo(this)\">\r";
        DataTable crs = ud.getSiteList();
        if (crs != null)
        {
            for (int i = 0; i < crs.Rows.Count; i++)
            {
                string getSiteID = SessionSiteID;
                string SiteID1 = crs.Rows[i]["ChannelID"].ToString();
                if (getSiteID != SiteID1)
                {
                    siteStr += "<option value=\"" + crs.Rows[i]["ChannelID"] + "\">" + crs.Rows[i]["CName"] + "</option>\r";
                }
                else
                {
                    siteStr += "<option value=\"" + crs.Rows[i]["ChannelID"] + "\"  selected=\"selected\">" + crs.Rows[i]["CName"] + "</option>\r";
                }
            }
        }
        //}
        siteStr += "</select>\r";
        return siteStr;
    }

    //更新权重
    protected void updateOrder(string ClassID, int OrderID)
    {
        rd.updateOrderP(ClassID, OrderID);
        pd.SaveUserAdminLogs(0, 1, UserNum, "更新权重", "ClassID:" + ClassID + "");
        PageRight("更新权重成功!", "class_list.aspx");
    }

    //更改操作状态
    protected void StaticChange(string Classid)
    {
        // 获取id编号
        int intStr = 0;
        DataTable dt = rd.getClassContent(Classid.ToString(),6);
        if (dt != null)
        {
            if (dt.Rows.Count > 0)
            {
                intStr = int.Parse(dt.Rows[0]["isLock"].ToString());
            }
            dt.Clear(); dt.Dispose();
        }
        if (intStr == 0)
        {
            intStr = 1;
        }
        else
        {
            intStr = 0;
        }
        rd.ChangeLock(Classid, intStr);
    }

    //批量锁定/解锁数据
    protected void Lock_Click(object sender, EventArgs e)
    {
        this.Authority_Code = "C029";
        this.CheckAdminAuthority();
        string Str = Request.Form["Checkbox1"];
        if (Str == null || Str == string.Empty)
        {
            PageError("请至少选择一项!", "");
        }
        else
        {
            string[] Checkbox = (Str.ToString()).Split(',');
            for (int i = 0; i < Checkbox.Length; i++)
            {
                StaticChange(Checkbox[i]);
            }
            pd.SaveUserAdminLogs(0, 1, UserNum, "锁定/解锁操作", "锁定/解锁操作栏目.ClassID:" + Request.Form["Checkbox1"] + "");
            //此处进行静态文件的删除
            PageRight("锁定/解锁操作栏目成功,请返回继续操作!", "class_list.aspx");
        }
    }

    //分页处理
    protected void PageNavigator1_PageChange(object sender, int PageIndex)
    {
        StartLoad(PageIndex);
    }

    //数据初始化
    protected void StartLoad(int PageIndex)
    {
        int i, j;
        string _SiteID = Request.QueryString["SiteID"];
        DataTable dt = null;
        if (_SiteID != null && _SiteID != string.Empty)
        {
            if (SiteID == "0")
            {
                SQLConditionInfo st = new SQLConditionInfo("@SiteID", _SiteID.ToString());
                dt = NetCMS.Content.Pagination.GetPage("manage_news_class_list_1_aspx", PageIndex, 50, out i, out j, st);
            }
            else
            {
                dt = NetCMS.Content.Pagination.GetPage(this.GetType().Name, PageIndex, 50, out i, out j, null);
            }
        }
        else
        {
            SQLConditionInfo st = new SQLConditionInfo("@SiteID", SiteID);
            dt = NetCMS.Content.Pagination.GetPage("manage_news_class_list_1_aspx", PageIndex, 50, out i, out j, st);
        }
        //else
        //{
        //     dt = NetCMS.Content.Pagination.GetPage(this.GetType().Name, PageIndex, 50, out i, out j, null);
        //}
        this.PageNavigator1.PageCount = j;
        this.PageNavigator1.PageIndex = PageIndex;
        this.PageNavigator1.RecordCount = i;
        if (dt != null)
        {
            dt.Columns.Add("st", typeof(string));
            dt.Columns.Add("pop", typeof(string));
            dt.Columns.Add("Colum", typeof(string));
            dt.Columns.Add("ClassCNames", typeof(string));
            bool fg = false;
            for (int k = 0; k < dt.Rows.Count; k++)
            {
                if (IsSuper == "1")
                {
                    fg = true;
                }
                else
                {
                    if (ClassList.IndexOf(dt.Rows[k]["ClassID"].ToString()) >= 0)
                    {
                        fg = true;
                    }
                    else
                    {
                        fg = false;
                    }
                }
                if (fg)
                {
                    string strchar = "";
                    //取出子类
                    if (dt.Rows[k]["isPage"].ToString() == "1")
                    {
                        dt.Rows[k]["ClassCNames"] = "<a href=\"news_Page.aspx?ClassID=" + dt.Rows[k]["ClassID"] + "&Action=Edit\" class=\"list_link\" title=\"点击修改单页面\">" + dt.Rows[k]["ClassCName"] + "</a>";
                    }
                    else
                    {
                        dt.Rows[k]["ClassCNames"] = "<a href=\"Class_Add.aspx?Cname=" + Server.UrlEncode(dt.Rows[k]["ClassCName"].ToString()) + "&Acation=Add," + dt.Rows[k]["ClassID"] + "&SiteID=" + Request.QueryString["SiteID"] + "\" class=\"list_link\" title=\"点击修改栏目\">" + dt.Rows[k]["ClassCName"] + "[" + dt.Rows[k]["ClassEname"] + "]</a>";
                    }
                    if (dt.Rows[k]["IsURL"].ToString() == "1")
                    {
                        dt.Rows[k]["st"] = "<font color=blue>外部</font>&nbsp;&nbsp;";
                    }
                    else
                    {
                        dt.Rows[k]["st"] = "<font color=red>系统</font>&nbsp;&nbsp;";
                    }
                    if (dt.Rows[k]["isPage"].ToString() == "1")
                    {
                        dt.Rows[k]["st"] += "<font color=\"#FF9900\">单页</font>&nbsp;&nbsp;";
                    }
                    else
                    {
                        dt.Rows[k]["st"] += "普通&nbsp;&nbsp;";
                    }

                    if (dt.Rows[k]["IsLock"].ToString() == "1")
                    {
                        dt.Rows[k]["st"] += "<a href=\"?Stat=Change&id=" + dt.Rows[k]["ClassID"] + "\" title=\"点击正常\" class=\"list_link\">锁定</a> ";
                    }
                    else
                    {
                        dt.Rows[k]["st"] += "<a href=\"?Stat=Change&id=" + dt.Rows[k]["ClassID"] + "\" title=\"点击锁定\" class=\"list_link\"><font color=\"green\">正常</font></a> ";
                    }

                    if (dt.Rows[k]["Domain"].ToString().Length > 5)
                    {
                        dt.Rows[k]["st"] += "<font color=\"blue\">域</font>&nbsp;&nbsp;";
                    }
                    else
                    {
                        dt.Rows[k]["st"] += "<font color=\"#999999\">域</font>&nbsp;&nbsp;";
                    }
                    if (dt.Rows[k]["NaviShowtf"].ToString() == "1")
                    {
                        dt.Rows[k]["st"] += "<font color=\"red\">显示</font>&nbsp;&nbsp;";
                    }
                    else
                    {
                        dt.Rows[k]["st"] += "隐藏&nbsp;&nbsp;";
                    }

                    string _TempStr = "";
                    if (dt.Rows[k]["IsURL"].ToString() == "0")
                    {
                        if (dt.Rows[k]["isPage"].ToString() == "0")
                        {
                            _TempStr = "<a title=\"添加新闻\" href=\"News_add.aspx?ClassID=" + dt.Rows[k]["ClassID"].ToString() + "&EditAction=add\"><img src=\"../../sysImages/" + NetCMS.Config.UIConfig.CssPath() + "/sysico/addnews.gif\" border=\"0\" title=\"添加新闻\" /></a><a href=\"Class_add.aspx?Cname=" + Server.UrlEncode(dt.Rows[k]["ClassCName"].ToString()) + "&Number=" + dt.Rows[k]["ClassID"] + "&SiteID=" + Request.QueryString["SiteID"] + "\" class=\"list_link\"><img src=\"../../sysImages/" + NetCMS.Config.UIConfig.CssPath() + "/sysico/addclass.gif\" border=\"0\" title=\"添加子类\" /></a><a href=\"news_Page.aspx?Number=" + dt.Rows[k]["ClassID"] + "\" class=\"list_link\"><img src=\"../../sysImages/" + NetCMS.Config.UIConfig.CssPath() + "/sysico/addpage.gif\" border=\"0\" title=\"添加单页面\" /></a>";
                        }
                    }
                    if (dt.Rows[k]["isPage"].ToString() == "1")
                    {
                        dt.Rows[k]["pop"] = "<input name=\"Checkbox1\" type=\"checkbox\" value=" + dt.Rows[k]["ClassID"] + " />&nbsp;&nbsp;<a href=\"news_Page.aspx?ClassID=" + dt.Rows[k]["ClassID"] + "&Action=Edit\" class=\"list_link\"><img src=\"../../sysImages/" + NetCMS.Config.UIConfig.CssPath() + "/sysIco/edit.gif\" border=\"0\" title=\"修改\" /></a><a href=\"news_review.aspx?ID=" + dt.Rows[k]["ClassID"] + "&type=class\" class=\"list_link\" target=\"_blank\"><img src=\"../../sysImages/" + NetCMS.Config.UIConfig.CssPath() + "/sysIco/review.gif\" border=\"0\" title=\"浏览\" /></a>" + _TempStr + "";
                    }
                    else
                    {
                        dt.Rows[k]["pop"] = "<input name=\"Checkbox1\" type=\"checkbox\" value=" + dt.Rows[k]["ClassID"] + " />&nbsp;&nbsp;<a href=\"Class_Add.aspx?Cname=" + Server.UrlEncode(dt.Rows[k]["ClassCName"].ToString()) + "&Acation=Edit," + dt.Rows[k]["ClassID"] + "&SiteID=" + Request.QueryString["SiteID"] + "\" class=\"list_link\"><img src=\"../../sysImages/" + NetCMS.Config.UIConfig.CssPath() + "/sysIco/edit.gif\" border=\"0\" title=\"修改\" /></a><a href=\"news_review.aspx?ID=" + dt.Rows[k]["ClassID"] + "&type=class\" class=\"list_link\" target=\"_blank\"><img src=\"../../sysImages/" + NetCMS.Config.UIConfig.CssPath() + "/sysIco/review.gif\" border=\"0\" title=\"浏览\" /></a>" + _TempStr + "";
                    }
                    strchar += "<tr class=\"TR_BG_list\"  onmouseover=\"overColor(this)\" onmouseout=\"outColor(this)\">";
                    strchar += "<td  align=\"center\" valign=\"middle\" height=20>" + dt.Rows[k]["id"] + "</td>";
                    strchar += "<td  align=\"left\" valign=\"middle\" ><img src=\"../../sysImages/folder/yess.gif\" border=\"0\">&nbsp;" + dt.Rows[k]["ClassCNames"] + "<span style=\"font-size:10px;color:red\" title=\"新闻数\">(" + rd.GetClassNewsCount(dt.Rows[k]["ClassID"].ToString()) + ")</span></td>";
                    strchar += "<td  align=\"center\" valign=\"middle\" ><a class=\"list_link\" href=\"javascript:orderAction('" + dt.Rows[k]["ClassID"] + "'," + dt.Rows[k]["OrderID"] + ");\" title=\"点击排序\"><strong>" + dt.Rows[k]["OrderID"] + "</a></strong></td>";
                    strchar += "<td  align=\"center\" valign=\"middle\" >" + dt.Rows[k]["st"] + "</td>";
                    strchar += "<td valign=\"middle\" >" + dt.Rows[k]["pop"] + "</td>";
                    strchar += "</tr>";
                    strchar += getchildClassList(dt.Rows[k]["ClassID"].ToString(), "┝");
                    dt.Rows[k]["Colum"] = strchar;
                }
                else
                {
                    dt.Rows[k].Delete();
                }
            }
        }
        DataList1.DataSource = dt;
        DataList1.DataBind();
    }

    //递归
    string getchildClassList(string Classid, string sign)
    {
        #region
        string strchar = "";
        DataTable dt = rd.getClassContent(Classid,5);
        sign += " ┉ ";
        if (dt != null)
        {
            if (dt.Rows.Count > 0)
            {
                dt.Columns.Add("st", typeof(string));
                dt.Columns.Add("pop", typeof(string));
                dt.Columns.Add("Colum", typeof(string));
                dt.Columns.Add("ClassCNames", typeof(string));
                for (int j = 0; j < dt.Rows.Count; j++)
                {
                    if (dt.Rows[j]["isPage"].ToString() == "1")
                    {
                        dt.Rows[j]["ClassCNames"] = "<a href=\"news_Page.aspx?ClassID=" + dt.Rows[j]["ClassID"] + "&Action=Edit\" class=\"list_link\" title=\"点击修改单页面\">" + dt.Rows[j]["ClassCName"] + "</a>";
                    }
                    else
                    {
                        dt.Rows[j]["ClassCNames"] = "<a href=\"Class_Add.aspx?Cname=" + Server.UrlEncode(dt.Rows[j]["ClassCName"].ToString()) + "&Acation=Add," + dt.Rows[j]["ClassID"] + "&SiteID=" + Request.QueryString["SiteID"] + "\" class=\"list_link\" title=\"点击修改栏目\">" + dt.Rows[j]["ClassCName"] + "[" + dt.Rows[j]["ClassEname"] + "]</a>";
                    }
                    if (dt.Rows[j]["IsURL"].ToString() == "1")
                    {
                        dt.Rows[j]["st"] = "<font color=\"blue\">外部</font>&nbsp;&nbsp;";
                    }
                    else
                    {
                        dt.Rows[j]["st"] = "<font color=\"red\">系统</font>&nbsp;&nbsp;";
                    }
                    if (dt.Rows[j]["isPage"].ToString() == "1")
                    {
                        dt.Rows[j]["st"] += "<font color=\"#FF9900\">单页</font>&nbsp;&nbsp;";
                    }
                    else
                    {
                        dt.Rows[j]["st"] += "普通&nbsp;&nbsp;";
                    }
                    if (dt.Rows[j]["IsLock"].ToString() == "1")
                    {
                        dt.Rows[j]["st"] += "<a href=\"?Stat=Change&id=" + dt.Rows[j]["ClassID"] + "\" title=\"点击正常\" class=\"list_link\">锁定</a> ";
                    }
                    else
                    {
                        dt.Rows[j]["st"] += "<a href=\"?Stat=Change&id=" + dt.Rows[j]["ClassID"] + "\" title=\"点击锁定\" class=\"list_link\"><font color=\"green\">正常</font></a> ";
                    }
                    if (dt.Rows[j]["Domain"].ToString().Length > 5)
                    {
                        dt.Rows[j]["st"] += "<font color=\"blue\">域</font>&nbsp;&nbsp;";
                    }
                    else
                    {
                        dt.Rows[j]["st"] += "<font color=\"#999999\">域</font>&nbsp;&nbsp;";
                    }
                    if (dt.Rows[j]["NaviShowtf"].ToString() == "1")
                    {
                        dt.Rows[j]["st"] += "<font color=\"red\">显示</font>&nbsp;&nbsp;";
                    }
                    else
                    {
                        dt.Rows[j]["st"] += "隐藏&nbsp;&nbsp;";
                    }

                    string _TempStr = "";
                    if (dt.Rows[j]["IsURL"].ToString() == "0")
                    {
                        if (dt.Rows[j]["isPage"].ToString() == "0")
                        {
                            _TempStr = "<a title=\"添加新闻\" href=\"News_add.aspx?ClassID=" + dt.Rows[j]["ClassID"].ToString() + "&EditAction=add\"><img src=\"../../sysImages/" + NetCMS.Config.UIConfig.CssPath() + "/sysico/addnews.gif\" border=\"0\" /></a><a href=\"Class_add.aspx?Cname=" + Server.UrlEncode(dt.Rows[j]["ClassCName"].ToString()) + "&Number=" + dt.Rows[j]["ClassID"] + "&SiteID=" + Request.QueryString["SiteID"] + "\" class=\"list_link\"><img src=\"../../sysImages/" + NetCMS.Config.UIConfig.CssPath() + "/sysico/addclass.gif\" border=\"0\" title=\"添加子类\" /></a><a href=\"news_Page.aspx?Number=" + dt.Rows[j]["ClassID"] + "\" class=\"list_link\"><img src=\"../../sysImages/" + NetCMS.Config.UIConfig.CssPath() + "/sysico/addpage.gif\" border=\"0\" title=\"添加单页面\" /></a>";
                        }
                    }

                    //操作
                    if (dt.Rows[j]["isPage"].ToString() == "1")
                    {
                        dt.Rows[j]["pop"] = "<input name=\"Checkbox1\" type=\"checkbox\" value=" + dt.Rows[j]["ClassID"] + " />&nbsp;&nbsp;<a href=\"news_Page.aspx?ClassID=" + dt.Rows[j]["ClassID"] + "&Action=Edit\" class=\"list_link\"><img src=\"../../sysImages/" + NetCMS.Config.UIConfig.CssPath() + "/sysIco/edit.gif\" border=\"0\" title=\"修改\"></a><a href=\"news_review.aspx?ID=" + dt.Rows[j]["ClassID"] + "&type=class\" class=\"list_link\" target=\"_blank\"><img src=\"../../sysImages/" + NetCMS.Config.UIConfig.CssPath() + "/sysIco/review.gif\" border=\"0\" title=\"浏览\" /></a>" + _TempStr + "";
                    }
                    else
                    {
                        dt.Rows[j]["pop"] = "<input name=\"Checkbox1\" type=\"checkbox\" value=" + dt.Rows[j]["ClassID"] + " />&nbsp;&nbsp;<a href=\"Class_Add.aspx?Cname=" + Server.UrlEncode(dt.Rows[j]["ClassCName"].ToString()) + "&Acation=Add," + dt.Rows[j]["ClassID"] + "&SiteID=" + Request.QueryString["SiteID"] + "\" class=\"list_link\"><img src=\"../../sysImages/" + NetCMS.Config.UIConfig.CssPath() + "/sysIco/edit.gif\" border=\"0\" title=\"修改\"></a><a href=\"news_review.aspx?ID=" + dt.Rows[j]["ClassID"] + "&type=class\" class=\"list_link\" target=\"_blank\"><img src=\"../../sysImages/" + NetCMS.Config.UIConfig.CssPath() + "/sysIco/review.gif\" border=\"0\" title=\"浏览\" /></a>" + _TempStr + "";
                    }
                    strchar += "<tr class=\"TR_BG_list\"  onmouseover=\"overColor(this)\" onmouseout=\"outColor(this)\">";
                    strchar += "<td align=\"center\" valign=\"middle\" height=20>" + dt.Rows[j]["id"] + "</td>";
                    strchar += "<td align=\"left\" valign=\"middle\" >" + sign + dt.Rows[j]["ClassCNames"] + "<span style=\"font-size:10px;color:red;\" title=\"新闻数\">(" + rd.GetClassNewsCount(dt.Rows[j]["ClassID"].ToString()) + ")</span></td>";
                    strchar += "<td align=\"center\" valign=\"middle\" ><a class=\"list_link\" href=\"javascript:orderAction('" + dt.Rows[j]["ClassID"] + "'," + dt.Rows[j]["OrderID"] + ");\" title=\"点击排序\"><strong>" + dt.Rows[j]["OrderID"] + "</strong></a></td>";
                    strchar += "<td align=\"center\" valign=\"middle\" >" + dt.Rows[j]["st"] + "</td>";
                    strchar += "<td valign=\"middle\" >" + dt.Rows[j]["pop"] + "</td>";
                    strchar += "</tr>";
                    strchar += getchildClassList(dt.Rows[j]["ClassID"].ToString(), sign);
                    dt.Rows[j]["Colum"] = strchar;
                }
                dt.Clear(); dt.Dispose();
            }
        }
        return strchar;
        #endregion
    }

    //彻底批量删除数据
    protected void Selected_del_Click(object sender, EventArgs e)
    {
        #region
        this.Authority_Code = "C030";
        this.CheckAdminAuthority();
        String Str = Request.Form["Checkbox1"];
        if (Str == null || Str == String.Empty)
        {
            PageError("请先选择删除项!", "");
        }
        else
        {
            String[] Checkbox = Str.Split(',');
            Str = null;
            for (int i = 0; i < Checkbox.Length; i++)
            {
                rd.del_newsInfos(Checkbox[i],1);
                rd.GetChildClassdel(Checkbox[i],0);

            }
            pd.SaveUserAdminLogs(1, 1, UserNum, "删除栏目", "彻底删除栏目.ClassID:" + Request.Form["Checkbox1"] + "");
            //此处进行静态文件的删除
            PageRight("彻底删除栏目成功!", "class_list.aspx");
        }
        #endregion
    }

    /// <summary>
    /// 初始化栏目
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void del_allClass(object sender, EventArgs e)
    {
        //权限管理
        this.Authority_Code = "C027";
        this.CheckAdminAuthority();
        rd.delUpdate_newsClass(1);
        pd.SaveUserAdminLogs(1, 1, UserNum, "初始化栏", "删除了所有栏目及内容信息");
        //此处进行静态文件的删除
        PageRight("初始化栏成功!", "class_list.aspx");
    }

    /// <summary>
    /// 生成XML
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void makeXML(object sender, EventArgs e)
    {
        this.Authority_Code = "C031";
        this.CheckAdminAuthority();
        string Str = Request.Form["Checkbox1"];
        if (Str == null || Str == String.Empty)
        {
            PageError("请至少选择一项!", "");
        }
        else
        {
            string[] Checkbox = Str.Split(',');
            Str = null;
            int j = 0;
            for (int i = 0; i < Checkbox.Length; i++)
            {
                if (NetCMS.Publish.General.publishXML(Checkbox[i]))
                {
                    j++;
                }
            }
            PageRight("生成" + j + "个XML成功!", "class_list.aspx");
        }
    }

    /// <summary>
    /// 生成HTML
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void makeHTML(object sender, EventArgs e)
    {
        this.Authority_Code = "C032";
        this.CheckAdminAuthority();
        string Str = Request.Form["Checkbox1"];
        if (Str == null || Str == String.Empty)
        {
            PageError("请至少选择一项!", "");
        }
        else
        {
            NetCMS.Control.HProgressBar.Start();
            NetCMS.Publish.General PG = new NetCMS.Publish.General();
            try
            {
                NetCMS.Control.HProgressBar.Roll("正在发布栏目", 0);
                string[] Checkboxs = Str.Split(',');
                Str = null;
                int j = 0;
                int m = Checkboxs.Length;
                for (int i = 0; i < m; i++)
                {
                    if (rd.delUpdate_news(Checkboxs[i],11) == 0)
                    {
                        if (PG.publishSingleClass(Checkboxs[i].ToString()))
                        {
                            j++;
                        }
                    }
                    else
                    {
                        if (NetCMS.Publish.General.publishPage(Checkboxs[i].ToString()))
                        {
                            j++;
                        }
                    }
                    NetCMS.Control.HProgressBar.Roll("共生成" + m + "个栏目，正在发布" + (i + 1) + "个。", ((i + 1) * 100 / m));
                }
                NetCMS.Control.HProgressBar.Roll("发布栏目成功,成功" + j + "个,<a href=\"../Publish/error/geterror.aspx?\">失败" + (Checkboxs.Length - j) + "个(可能有栏目有浏览权限)</a>. &nbsp;<a href=\"class_list.aspx\">返回</a>", 100);
            }
            catch (Exception ex)
            {
                NetCMS.Common.Public.savePublicLogFiles("□□□发布栏目", "【错误描述：】\r\n" + ex.ToString(), UserName);
                NetCMS.Control.HProgressBar.Roll("发布栏目失败。<a href=\"../publish/error/geterror.aspx?\">查看日志</a>", 0);
            }
            Response.End();
        }
    }

    protected void makeClassIndex(object sender, EventArgs e)
    {
        string Str = Request.Form["Checkbox1"];
        if (Str == null || Str == String.Empty)
        {
            PageError("请至少选择一项!", "");
        }
        else
        {
            string[] Checkboxs = Str.Split(',');
            Str = null;
            int j = 0;
            int m = 0;
            for (int i = 0; i < Checkboxs.Length; i++)
            {
                if (rd.delUpdate_news(Checkboxs[i],11) == 0)
                {
                    if (NetCMS.Publish.General.publishClassIndex(Checkboxs[i]))
                    {
                        j++;
                    }
                    else
                    {
                        m++;
                    }
                }
            }
            PageRight("共生成" + j + "个栏目!失败" + m + "个栏目。<li>如果生成有差异，可能是您选择了单页面</li>", "class_list.aspx");
        }
    }

    /// <summary>
    /// 清除数据
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void clearNewsInfo(object sender, EventArgs e)
    {
        this.Authority_Code = "C033";
        this.CheckAdminAuthority();
        String Str = Request.Form["Checkbox1"];
        if (Str == null || Str == String.Empty)
        {
            PageError("请至少选择一项!", "");
        }
        else
        {
            String[] Checkbox = Str.Split(',');
            Str = null;
            for (int i = 0; i < Checkbox.Length; i++)
            {
                rd.del_News(Checkbox[i],3);
            }
            pd.SaveUserAdminLogs(1, 1, UserNum, "清除数据", "清除数据.ClassID:" + Request.Form["Checkbox1"] + "");
            PageRight("清除数据成功!", "class_list.aspx");
        }
    }


    //放入回收站
    protected void AllDel_Click(object sender, EventArgs e)
    {
        this.Authority_Code = "CE01";
        this.CheckAdminAuthority();
        String Str = Request.Form["Checkbox1"];
        if (Str == null || Str == String.Empty)
        {
            PageError("请先选择删除项!", "");
        }
        else
        {
            String[] Checkbox = Str.Split(',');
            Str = null;
            for (int i = 0; i < Checkbox.Length; i++)
            {
                rd.del_newsInfos(Checkbox[i],0);
                rd.GetChildClassdel(Checkbox[i],1);
            }
            pd.SaveUserAdminLogs(1, 1, UserNum, "删除栏目", "删除栏目到回收站.ClassID:" + Request.Form["Checkbox1"] + "");
            PageRight("删除数据到回收站成功,请返回继续操作!", "class_list.aspx");
        }
    }

    //复位操作
    protected void LinkButton1_Click(object sender, EventArgs e)
    {
        //权限管理
        this.Authority_Code = "C024";
        this.CheckAdminAuthority();
        string str_ClassID = Request.Form["Checkbox1"];
        if (str_ClassID != null && str_ClassID != "")
            str_ClassID = "'" + str_ClassID.Replace(",", "','") + "'";
        else
            str_ClassID = null;
        rd.del_News(str_ClassID,4);
        PageRight("操作成功,此操作对锁定栏目无效!", "Class_list.aspx");
    }

    //一级排序操作
    protected void FirsSort_Click(object sender, EventArgs e)
    {
        Response.Redirect("SortPage.aspx?Acton=First");
    }
}
